// Copyright (C)2012 Johann Duscher. All rights reserved.
//
// This file is part of QwTAPI.
//
// QwTAPI is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// QwTAPI is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with QwTAPI.  If not, see <http://www.gnu.org/licenses/>.

#pragma once

#include "QwTAPI.h"


namespace qwtapi
{

class Line;

class QWTAPI_EXPORT LineListener : public QObject
{
    Q_OBJECT

    typedef QObject super;

public:
    LineListener(QObject* pParent);

    virtual HLINE getLineHandle() const = 0;

public slots:
    virtual void onClose();
    virtual void onDynamicCreate();
    virtual void onDynamicRemove();

    virtual void onLineEvent(DWORD hDevice, Message::Constant msg, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3);

protected:
    virtual void onAppNewCall(DWORD addressId, HCALL hCall, CallPrivilege::Constant privilege);
    virtual void onDevSpecific(DWORD hLineOrCall, DWORD devSpecific1, DWORD devSpecific2, DWORD devSpecific3);
    virtual void onDevSpecificFeature(DWORD hLineOrCall, DWORD devSpecific1, DWORD devSpecific2, DWORD devSpecific3);
    virtual void onGatherDigits(HCALL hCall, GatherTerm::Constant gatherTermination, DWORD tickCount);
    virtual void onGenerate(HCALL hCall, GenerateTerm::Constant generateTermination, DWORD tickCount);
    virtual void onLineDevState(LineDevState::Constants devState, DWORD devStateDetail1, DWORD devStateDetail2);
    virtual void onMonitorDigits(HCALL hCall, DWORD digit, DigitMode::Constant digitMode, DWORD tickCount);
    virtual void onMonitorMedia(HCALL hCall, MediaMode::Constant mediaMode, DWORD tickCount);
    virtual void onMonitorTone(HCALL hCall, DWORD appSpecific, DWORD tickCount);


    virtual void onCallInfoState(HCALL hCall, CallInfoState::Constants callInfoState);


    virtual void onCallState(HCALL hCall, CallState::Constant callState, DWORD callStateDetail, CallPrivilege::Constant callPrivilege);
    virtual void onCallStateIdle(HCALL hCall);
    virtual void onCallStateOffering(HCALL hCall, DWORD callStateDetail);
    virtual void onCallStateAccepted(HCALL hCall);
    virtual void onCallStateDialtone(HCALL hCall, DWORD callStateDetail);
    virtual void onCallStateDialing(HCALL hCall);
    virtual void onCallStateRingback(HCALL hCall);
    virtual void onCallStateBusy(HCALL hCall, DWORD callStateDetail);
    virtual void onCallStateConnected(HCALL hCall, DWORD callStateDetail);
    virtual void onCallStateProceeding(HCALL hCall);
    virtual void onCallStateHold(HCALL hCall);
    virtual void onCallStateHoldPendingConference(HCALL hCall);
    virtual void onCallStateHoldPendingTransfer(HCALL hCall);
    virtual void onCallStateSpecialInfo(HCALL hCall, DWORD callStateDetail);
    virtual void onCallStateDisconnected(HCALL hCall, DWORD callStateDetail);
    virtual void onCallStateConferenced(HCALL hCall);
    virtual void onCallStateUnknown(HCALL hCall, DWORD callStateDetail, CallPrivilege::Constant callPrivilege);


    virtual void onAddressState(DWORD addressId, AddressState::Constants addressState);
};

}
